home *** CD-ROM | disk | FTP | other *** search
- // execpgm.c example 3a
- // cl /AL /Lp execpgm.c
- // bind286 execpgm
- // execpgm
-
- // execpgm.c - Example program to show how DosExecPgm is used to create
- // a new process. This program starts CHILD.EXE as a new process.
- // By having this program print "P" and "CHILD.EXE" print "C", it is
- // possible to see how the execution of both processes is switched.
-
- extern unsigned far pascal DosExecPgm
- (
- char far *, //BYTES output ->FailObjName
- unsigned, //WORD input FailObjNameLen
- unsigned, //WORD input ExecType
- char far *, //ASCIIZS input ->Arg
- char far *, //ASCZIIS input ->Env
- struct RetInfo far *, //DWORD output ->RetInfo
- char far * //ASCIIZ input ->PgmName
- );
-
- struct RetInfo
- {
- unsigned TermCode;
- unsigned RetCode ;
- };
-
- #define ExecType 1
- #define PGM "child.exe"
- #define NMSG 1800
-
- unsigned far pascal DosSleep(unsigned long);
-
- main()
- {
- struct RetInfo ChildInfo;
- int i;
- printf("parent Started ");
- DosExecPgm(0l,0,ExecType,0l,0l,&ChildInfo,PGM);
- for (i = 1; i <=NMSG; i++){
- printf("P");
- DosSleep(0);
- }
- printf(" parent ended ");
- }